public class Demo {
    public static void main(String[] args) {

    }
}
class Solution {
    public int removeDuplicates(int[] nums) {
    int left = 0;
    int right = 1;
        for ( right = 0; right < nums.length-1; right++) {
            for (int j = 0; j < left; j++) {
                if(nums[j]==nums[right]){
                    break;
                }
            }
            nums[left+1] = nums[right];
            left++;
        }
        return left;
    }
}










class Solution1 {
    public int removeElement(int[] nums, int val) {
        int n = nums.length;
        int left = 0;
        for (int right = 0; right < n; right++) {
            if (nums[right] != val) {
                nums[left] = nums[right];
                left++;
            }
        }
        return left;
    }
}

